package com.mm.update.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;

/**
 * ClassName: TestUtil
 * Description:
 * date: 2024/5/17 11:09
 *
 * @author  
 * @since JDK 1.8
 */
public class TestUtil {
    public static void main1(String[] args) {
        Map<Integer,Integer> result = new HashMap<>();
        int m = 0;
        while (m < 1000000) {
            List<Integer> numList = new ArrayList<>(600);
            for (int j = 1; j <= 600; j++) {
                numList.add(j);
            }
            while (numList.size() > 1) {
                int length = numList.size();
                Random random = new Random();
                boolean jishu = length % 2 == 1;
                int i1 = 0;
                if (length == 2) {
                    i1 = 0;
                } else {
                    if (jishu) {
                        i1 = random.nextInt((length +1)/ 2) * 2 ;
                    } else {
                        i1 = random.nextInt(length / 2 ) * 2 ;
                    }
                }

                numList.remove(i1);
            }
            Integer integer = numList.get(0);
            result.put(integer,result.getOrDefault(integer,0)+1);
            m++;
        }
        for (Map.Entry<Integer, Integer> integerIntegerEntry : result.entrySet()) {
            System.out.println(integerIntegerEntry.getKey()+"---"+integerIntegerEntry.getValue());
        }
    }

    public static void main(String[] args) throws ParseException {
        SimpleDateFormat ddMMMyyyy = new SimpleDateFormat("ddMMMyyyy", Locale.ENGLISH);
        SimpleDateFormat ddMMMyyyy1 = new SimpleDateFormat("ddMMMyyyy",Locale.SIMPLIFIED_CHINESE);
        SimpleDateFormat yy = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd-HHmm", Locale.ENGLISH);
        String da = "06Jun2024";
        Date parse = ddMMMyyyy.parse(da);
        System.out.println(parse.getTime());
        String dateStr1 = sdf.format(parse);
        System.out.println(dateStr1);
        String dateStr = sdf.format(parse);
            String[] temp = dateStr.split("-");
        System.out.println(dateStr);
            System.out.println(temp[0]);
            System.out.println(temp[1]);
            System.out.println(temp[2]);
            System.out.println(temp[3]);
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MMM-dd-HHmm", Locale.ENGLISH);
        String da1 = "06Jun2024";
        Date parse1 = ddMMMyyyy.parse(da1);
        System.out.println(parse.getTime());
        String dateStr111 = sdf1.format(parse1);
        System.out.println(dateStr111);
        String dateStr11 = sdf1.format(parse1);
        String[] temp1 = dateStr11.split("-");
        System.out.println(dateStr11);
        System.out.println(temp1[0]);
        System.out.println(temp1[1]);
        System.out.println(temp1[2]);
        System.out.println(temp1[3]);
    }
}
